Skip to content

Conversation

@hakonanes
Copy link
Contributor

Signed-off-by: Håkon Wiik Ånes hwaanes@gmail.com

Hi!

I'm one of the developers of the orix Python package (https://github.com/pyxem/orix) for handling crystal orientation mapping data. We're depending on diffpy.structure for storage and handling of unit cell information in our Phase object, and will soon add a space group attribute via your SpaceGroup class to it. It would therefore be nice to have a string representation of SpaceGroup, hence this PR.

Result of this PR:

>>> from diffpy.structure.spacegroupmod import GetSpaceGroup
# Before
>>> print(GetSpaceGroup(229))
<diffpy.structure.spacegroupmod.SpaceGroup object at 0x7f819481a490>
# After
>>> print(GetSpaceGroup(229))
SpaceGroup #229 (Im-3m, Cubic). Symmetry matrices: 96, point sym. matr.: 48

Added:

  • a one-line SpaceGroup.__repr__() detailing space group number, short name, crystal system, number of symmetry matrices and number of point group symmetry matrices
  • a naive test for this method
  • the PyCharm project directory .idea and the htmlcov directory returned by $ coverage html to .gitignore

Tests pass with Python 3.7 and Python 2.7 from Anaconda.

I'll be happy to shorten the string if you find it too long, or change it if you prefer another representation.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@codecov
Copy link

codecov bot commented Jul 23, 2020

Codecov Report

Merging #45 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #45      +/-   ##
==========================================
+ Coverage   95.11%   95.12%   +0.01%     
==========================================
  Files          44       44              
  Lines        5203     5214      +11     
==========================================
+ Hits         4949     4960      +11     
  Misses        254      254              
Impacted Files Coverage Δ
src/diffpy/structure/spacegroupmod.py 92.08% <100.00%> (+0.11%) ⬆️
src/diffpy/structure/tests/testspacegroups.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 839020a...6e99d6b. Read the comment docs.

Copy link
Contributor

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hakonanes code looks good. I would like to capture this into docs/changelog if possible. @pavoljuhas is that done automatically here using commit messages (changelog) and scraping docstrings (docs)? We are behind with docs in general, but may as well handle this as well as we can moving forward...

Copy link
Member

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Håkon, Thank you for your contribution. Please remove the change to .gitignore, it should not be mixed up with changes to actual functionality. (You can rebase with the fixup commit I added).

I have also added an empty new section to the CHANGELOG.md.
Can you please add a one-line description of this feature?

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes requested a review from pavoljuhas July 24, 2020 08:38
Copy link
Member

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have noticed one more issue in the test, please correct.
Otherwise LGTM, thank you for contributing.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@pavoljuhas
Copy link
Member

@pavoljuhas is that done automatically here using commit messages (changelog) and scraping docstrings (docs)?

No, changelog needs to be updated manually. It is intended for users and should be easy to digest, it would be too noisy if generated from commit strings.

@pavoljuhas
Copy link
Member

Merged as fe4b46b. Thank you!

@hakonanes
Copy link
Contributor Author

Great, I hope other orix developers and I can contribute more in the future. Thank you!

@hakonanes hakonanes deleted the spacegroup-representation branch July 28, 2020 11:06
@sbillinge
Copy link
Contributor

sbillinge commented Jul 28, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants